#include "widget.h"
#include "ui_widget.h"
#include "QRect"
#include "QDebug"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QRect rect = ui->pbt_img->geometry();
    px = rect.x();
    py = rect.y();
    wx = rect.width();
    wy = rect.height();
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pbt_reset_clicked()
{
    ui->pbt_img->setGeometry(px,py,wx,wy);
}

void Widget::on_pbt_up_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->move(rect.x(),rect.y()-5);
}

void Widget::on_pbt_d_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->move(rect.x(),rect.y()+5);
}

void Widget::on_pbt_l_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->move(rect.x()-5,rect.y());
}

void Widget::on_pbt_r_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->move(rect.x()+5,rect.y());
}

void Widget::on_pbt_b_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->setGeometry(rect.x(),rect.y(),rect.width()+4,rect.height()+4);
    ui->pbt_img->move(rect.x()-2,rect.y()-2);
}

void Widget::on_pbt_s_clicked()
{
    QRect rect = ui->pbt_img->geometry();
    ui->pbt_img->setGeometry(rect.x(),rect.y(),rect.width()-4,rect.height()-4);
    ui->pbt_img->move(rect.x()+2,rect.y()+2);
}

void Widget::on_pbt_img_clicked()
{
    qDebug() << ui->pbt_img->geometry();
}
